home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / UPC12BS1.ZIP / LIB / SCRSIZNT.C < prev    next >
C/C++ Source or Header  |  1993-09-25  |  3KB  |  75 lines

  1. /*
  2.  *    $Id: scrsiznt.c 1.5 1993/09/26 03:32:27 dmwatt Exp $
  3.  *
  4.  *    $Log: scrsiznt.c $
  5.  *     Revision 1.5  1993/09/26  03:32:27  dmwatt
  6.  *     Use Standard Windows NT error message module
  7.  *
  8.  *     Revision 1.4  1993/04/10  21:22:29  dmwatt
  9.  *     Windows/NT fixes
  10.  *
  11.  *     Revision 1.3  1992/12/30  13:09:25  dmwatt
  12.  *     Correct boolean compare
  13.  *
  14.  */
  15.  
  16. /*--------------------------------------------------------------------*/
  17. /*    Copyright (c) David M. Watt 1993, All Rights Reserved           */
  18. /*--------------------------------------------------------------------*/
  19.  
  20. /*--------------------------------------------------------------------*/
  21. /*    Changes Copyright (c) 1989-1993 by Kendra Electronic            */
  22. /*    Wonderworks.                                                    */
  23. /*                                                                    */
  24. /*    All rights reserved except those explicitly granted by the      */
  25. /*    UUPC/extended license agreement.                                */
  26. /*--------------------------------------------------------------------*/
  27.  
  28. /*--------------------------------------------------------------------*/
  29. /*                        System include files                        */
  30. /*--------------------------------------------------------------------*/
  31.  
  32. #include <stdio.h>
  33.  
  34. #include <windows.h>
  35.  
  36. /*--------------------------------------------------------------------*/
  37. /*                    UUPC/extended include files                     */
  38. /*--------------------------------------------------------------------*/
  39.  
  40. #include "lib.h"
  41. #include "scrsize.h"
  42. #include "pnterr.h"
  43.  
  44. /*--------------------------------------------------------------------*/
  45. /*                    Internal function prototypes                    */
  46. /*--------------------------------------------------------------------*/
  47.  
  48. currentfile();
  49.  
  50. /*--------------------------------------------------------------------*/
  51. /*    s c r s i z e                                                   */
  52. /*                                                                    */
  53. /*    Return screen size under Windows/NT                             */
  54. /*--------------------------------------------------------------------*/
  55.  
  56. short scrsize( void )
  57. {
  58.    CONSOLE_SCREEN_BUFFER_INFO info;
  59.    BOOL result;
  60.    HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
  61.  
  62.    result = GetConsoleScreenBufferInfo(hStdout, &info);
  63.  
  64.    if ( result != TRUE )
  65.    {
  66.       DWORD dwError = GetLastError();
  67.       printmsg(0,"scrsize:  could not retrieve screen information");
  68.       printNTerror("GetConsoleScreenBufferInfo", dwError);
  69.       return PAGESIZE;
  70.    }
  71.  
  72.    return info.dwSize.Y;
  73. } /* scrsize */
  74.  
  75.